package com.xiaolin.spring.xml;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @ClassName StaticFactoryInjectTest
 * @Description TODO
 * @Detail 静态工厂方法注入
 * @Author MyPC
 * @Date 2020/10/27
 * @Version 1.0
 */
public class StaticFactoryInjectTest {

    private static StaticFactoryInjectTest staticFactoryTest=new StaticFactoryInjectTest();
    //构造器私有
    private StaticFactoryInjectTest(){

    }

    public static StaticFactoryInjectTest getInstance(){
        return staticFactoryTest;
    }

    public static void main(String[] args) {
        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("static-factory.xml");
        StaticFactoryInjectTest aStatic = applicationContext.getBean("static", StaticFactoryInjectTest.class);
        System.out.println(aStatic);
    }
}
